package cn.wzl.tanks.abstractfactory;

import cn.wzl.tanks.ResourceMrg;
import cn.wzl.tanks.TankFrame;
import cn.wzl.tanks.abstractfactory.BaseBoom;

import java.awt.*;

/**
 * @author weiZhiLin
 * @version 1.0
 * @date 2021/5/9 19:35
 */
// 爆炸
public class Boom extends BaseBoom {

    // 爆炸帧数
    private int boomIndex = 0;

    public Boom(int x, int y, Frame frame) {
        this.x = x;
        this.y = y;
        this.frame = (TankFrame) frame;
    }

    public void paint(Graphics g) {
        g.drawImage(ResourceMrg.BOOM[boomIndex++], x, y, null);
        if (boomIndex >= ResourceMrg.BOOM.length) {
            this.frame.booms.remove(this);
        }
    }
}
